package school.valon.constantes;

import school.valon.dto.ExpenseCategoryDto;

public enum EnumExpenseCategory {
	EXPENSE_CATEGORY1(1, "expense_category1"), EXPENSE_CATEGORY2(2, "expense_category2") ;

	private int expenseCategoryId;
	private String caption;
	private EnumExpenseCategory(int expenseCategoryId, String caption) {
		this.expenseCategoryId = expenseCategoryId;
		this.caption = caption;
	}

	public int getExpenseCategoryId() {
		return this.expenseCategoryId;
	}
	public String getCaption() {
		return this.caption;
	}

	public static EnumExpenseCategory getxpenseCategoryById(int typeId) {
		for(EnumExpenseCategory enumTypeIt : EnumExpenseCategory.values()) {
			if (enumTypeIt.expenseCategoryId == typeId) {
				return enumTypeIt;
			}
		}
		return null;
	}

	public ExpenseCategoryDto getExpenseCategoryDto() {
		ExpenseCategoryDto expenseCategoryDto = new ExpenseCategoryDto();
		expenseCategoryDto.setExpenseCategoryId(this.expenseCategoryId);
		return expenseCategoryDto;
	}
}
